import {legacy_createStore as createStore,applyMiddleware} from 'redux'
import shopcartReducer from './reducers/shopcartReducer'
//1、引入saga入口文件
import saga from './saga'
//2、从redux-saga包中引入createSagaMiddleware函数
import createSagaMiddleware from 'redux-saga'
//3、调用createSagaMiddleware
const sagaMiddleware=createSagaMiddleware()
const store=createStore(shopcartReducer,applyMiddleware(sagaMiddleware))
//4、执行sagaMiddleware中的run函数，run函数的参数就是saga入口文件生成器函数
sagaMiddleware.run(saga)
export default store